package com.samuel.blog.utils;

import java.io.IOException;

import javax.servlet.http.HttpServletResponse;

public class ResponseWriteUtils {

	/**
	 * 向外输出json格式数据
	 * @param response
	 * @param message
	 * @throws IOException
	 */
	public static void writeJson(HttpServletResponse response, Object message) {
		try {
			response.setContentType("application/json; charset=utf-8");
			response.getWriter().print(message);
			response.getWriter().flush();
			response.getWriter().close();
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
